Skip to content

Fix url-shortener python deploy scripts on current Azure CLI - #150

Closed
lazarkanelov wants to merge 1 commit into
localstack:mainfrom
lazarkanelov:fix/url-shortener-python-deploy-scripts
Closed

lazarkanelov wants to merge 1 commit into
localstack:mainfrom
lazarkanelov:fix/url-shortener-python-deploy-scripts

Conversation

@lazarkanelov

@lazarkanelov lazarkanelov commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Running the url-shortener/python sample against the latest localstack/localstack-azure image with Azure CLI 2.82.0 fails in two deploy scripts. Neither failure is an emulator issue.

  1. scripts/deploy.sh: az postgres flexible-server db create --name is rejected (unrecognized arguments: --name clicks). Current Azure CLI only accepts --database-name. A failed run also leaves a PostgreSQL server whose generated password was never saved, so the next run exits with "admin password is unknown".
  2. bicep/deploy.sh: Azure CLI prints "Bicep CLI is already installed at ..." on stdout during az deployment group create. The script captures stdout and pipes it to jq, so parsing fails ("jq: parse error") and the script exits with "Web App Name or Function App Name is empty" even though the deployment succeeded. --only-show-errors does not suppress the line.

Fix

  • scripts/deploy.sh: --name -> --database-name.
  • bicep/deploy.sh: after the deployment succeeds, keep only the JSON (sed -n '/^{/,$p') before the jq calls.

Verification

Latest localstack/localstack-azure image, Azure CLI 2.82.0, Apple silicon. From a clean state each time:

  • scripts/deploy.sh then scripts/validate.sh: all validation checks passed.
  • bicep/deploy.sh then scripts/validate.sh: all validation checks passed.
  • Terraform variant was already passing unchanged (not touched here).

- scripts/deploy.sh: use --database-name for 'az postgres flexible-server db create'; Azure CLI 2.82 rejects --name.
- bicep/deploy.sh: keep only the JSON deployment outputs; Azure CLI prints a Bicep notice on stdout that broke jq parsing.
@lazarkanelov

Copy link
Copy Markdown
Contributor Author

Superseded by #151: same change, pushed from a branch in this repo so CI can access the repository secrets (fork PRs cannot).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the deployment scripts’ Azure CLI compatibility updates.

No open issues 🎉

What changed in this PR

Updates the Python URL shortener sample’s deployment scripts for compatibility with current Azure CLI behavior.

Changes:

  • Uses --database-name when creating the PostgreSQL database.
  • Removes leading CLI notices from captured Bicep deployment output before parsing it with jq.
File Description
samples/​url-shortener/​python/​scripts/​deploy.sh Uses the supported PostgreSQL database-name argument.
samples/​url-shortener/​python/​bicep/​deploy.sh Filters stdout before parsing deployment outputs as JSON.

Review effort: Balanced

This branch had an error being deployed

1 failed deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants